Execute the commands in the job.
Parent Type: LearningStoreJob
Namespace: Microsoft.LearningComponents.Storage
Assembly: Microsoft.LearningComponents.Storage.dll
| C# |
|
public T Execute<T> () where T : class |
T
The result type.
The single piece of output data from the job
| Exception type | Condition |
| Microsoft.LearningComponents.Storage.LearningStoreItemNotFoundException | The job failed because an item was not found in the store. |
| Microsoft.LearningComponents.Storage.LearningStoreConstraintViolationException | The job failed because of a constraint violation. |
| Microsoft.LearningComponents.Storage.LearningStoreSecurityException | The job failed because a security check failed. |
| System.InvalidOperationException | The job successfully executed but there was more than one piece of output data or the output data couldn't be cast to the specified type, or an AddOrUpdateItem command failed because multiple matching items were found. |
Calls Execute and then casts the result to type T. If the result can't be cast to type T, or there is more than one result, an exception is thrown.
The following code adds a new user to the store specified by "store":
| C# |
LearningStore store = new LearningStore("Server=Learning;Database=Mls;Integrated Security=true", "Bob");
Dictionary<string,object> propertyValues = new Dictionary<string,object>();
propertyValues["Name"] = "John Doe";
propertyValues["Key"] = "Company\JohnDoe";
LearningStoreJob job = store.CreateJob();
job.AddItem("UserItem", propertyValues);
LearningStoreItemIdentifier id = job.Execute<LearningStoreItemIdentifier>();
|